import { storeBindingsBehavior } from "mobx-miniprogram-bindings";
import mall from "@src/store/mall";
import base from "@src/store/base";
import router from "@src/router";
import $math from "@src/common/math"
Component({
  behaviors: [storeBindingsBehavior],
  storeBindings: [{
    store: mall,
    fields: ['chooseAddress']
  }, {
    store: base,
    fields: ['isiPhoneX', 'themeColor', 'themeTitleColor', 'barHeight']
  }],
  properties: {
    goodsPresell: {
      type: Object,
      value: {}
    },
    deposit: {
      type: Number,
      value: 0
    },
    remaining: {
      type: Number,
      value: 0
    },
    items: {
      type: Array,
      value: []
    },
    totalFee: {
      type: Number
    },
    preSkuObject: {
      type: Object,
      value: {}
    }
  },
  observers: {
    'totalFee,preSkuObject': function (totalFee, preSkuObject) {
      if (preSkuObject && totalFee) {
        let finalPayment = $math.sub(totalFee / 100, preSkuObject.deposit / 100);
        this.setData({ finalPayment })
      }
    }
  },
  data: {
    address: null,
    selectIndex: 0,
    finalPayment: 0
  },

  methods: {


  }
});
